<?php

namespace IDock\Insurance\ZMBX\Request;

use IDock\Insurance\ZMBX\Request\AllZMBXRequest;
use IDock\Insurance\ZMBX\Response\VehicleActualValueResponse;
use IDock\Visitor\VehicleActualValueVisitor;

/**
 * 车辆实际价值计算
 */
class VehicleActualValueRequest extends AllZMBXRequest
{
    protected $route = 'ODR1016';

    public $requestCode = 'QuotedPrice';

    protected $response = VehicleActualValueResponse::class;

    protected $urlTip = '车辆实际价值计算';

    /**
     * @var VehicleActualValueVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $this->setZMBXToken($this->visitor->argc);
        $data = [
            'orderNo' => $this->visitor->argc['orderNo'],
            'prodNo' => $this->visitor->isNewEnergy ? '0358' : '0356',
            'effectiveDate' => date('Y-m-d H:i:s',strtotime($this->visitor->startDate)),
        ];

        if ($this->visitor->isNewEnergy) {
            $data['prodNo'] = '0358';
        }

        return $data;
    }
}
